﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccessLayer;
using BusinessLogicLayer;

namespace ChamCong.Admin
{
    public partial class QuanLyKQTangCa : BasePage
    {
        ShowBangCong show = new ShowBangCong();
        CongBLL cBLL = new CongBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                cBLL.KiemTraTinhCong(0);
            }
            catch { }
            if (!IsPostBack)
            {
                txtNam.Text = DateTime.Now.Year.ToString();
                drThang.SelectedValue = DateTime.Now.Month.ToString();
            }
        }

        protected void btnXem_Click(object sender, EventArgs e)
        {
            int mapb = int.Parse(drPhongBan.SelectedValue);
            string ten = txtNhanVien.Text;
            NhanVienBLL nvBLL = new NhanVienBLL();
            List<NHANVIEN2> nv = nvBLL.DSNhanVien2(mapb, ten);

            int nam = int.Parse(txtNam.Text);
            int thang = int.Parse(drThang.SelectedValue);
            if (nv.Count > 0)
            {
                lbDSTC.Text = show.BangTCMulti(nv, thang, nam);
            }
            else
            {
                lbDSTC.Text = "Nhân viên không tồn tại!";
            }
        }

        protected void btnAll_Click(object sender, EventArgs e)
        {
            int mapb = 0;
            string ten = "";
            NhanVienBLL nvBLL = new NhanVienBLL();
            List<NHANVIEN2> nv = nvBLL.DSNhanVien2(mapb, ten);

            int nam = int.Parse(txtNam.Text);
            int thang = int.Parse(drThang.SelectedValue);
            if (nv.Count > 0)
            {
                lbDSTC.Text = show.BangTCMulti(nv, thang, nam);
            }
            else
            {
                lbDSTC.Text = "Nhân viên không tồn tại!";
            }
        }
    }
}